#pragma once
#include <boost/signals2.hpp>
#include <nice2d/predef.h>
#include <nice2d/object.h>

enum ActionStatus {
    ActionStatus_Idel = 0,
    ActionStatus_Running,
    ActionStatus_Done,
    ActionStatus_Max
};

class Action : public Object
{
    DECLARE_OBJECT(Action)
public:
    Action(ObjectPointer owner = nullptr);
    virtual ~Action();
public:
    void setOwner(ObjectPointer newOwner);
    ObjectWeakPointer getOwner()const;

    void start();
    boost::signals2::signal<void()> started;

    void stop();
    boost::signals2::signal<void()> stoped;

    ActionStatus getStatus()const;
protected:
    virtual void onStart();
    virtual void onStop();
private:
    std::unique_ptr<class ActionData> data;
};
